package main

import (
	"fmt"
	_ "github.com/SimonWang00/goeureka"
	swaggerFiles "github.com/swaggo/files"
	ginSwagger "github.com/swaggo/gin-swagger"
	"vicente-gin/common"
	_ "vicente-gin/docs"
	"vicente-gin/dto"
	"vicente-gin/middleware"
	"vicente-gin/setting"
)

// @title          接囗文档
// @version        1.0
// @contact.name   shiweisen
// @contact.url	http://www.swagger.io/support
// @contact.email  shiweisen@126.com
// @host           127.0.0.1:8080
// @description 这里是描述
//	@termsOfService	http://swagger.io/terms/
//	@license.name	Apache 2.0
//	@license.url	http://www.apache.org/licenses/LICENSE-2.0.html
//	@BasePath	/api
func main() {
	fmt.Print("6666666666666666666666666666666666666")
	fmt.Println("1111111111111111111111111111111111")
	claims := &dto.UserInfoOut{
		ID:       "113",
		Username: "vicente",
		RoleId:   "12",
	}
	token, msg, ok := middleware.GenerateToken(claims)
	fmt.Println(token)
	fmt.Println(msg)
	fmt.Println(ok)
	fmt.Println("1111111111111111111111111111111111")

	sqlDB, _ := common.DB.DB()
	defer sqlDB.Close()

	routers := setting.InitRouters()
	//goeureka.RegisterClient("http://192.168.243.21:9001/", "", "go-gin-example", "9999", "43", nil)
	// 添加swagger访问路由
	routers.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerFiles.Handler))
	_ = routers.Run(":" + common.CONFIG.System.Port) // listen and serve on 0.0.0.0:8080
}

func init() {
	//初始华配置
	setting.InitConf()
	// 初始化日志
	setting.InitLogger()
	//初始华数据库连接
	setting.InitDb()

}
